#define _CRT_SECURE_NO_WARNINGS
class Solution {
public:
    string makeGood(string s) {
        string ans;
        for (auto ch : s)
        {
            if (ans.empty()) ans.push_back(ch);
            else
            {
                if (ans.back() + 32 == ch || ans.back() - 32 == ch)
                {
                    ans.pop_back();
                }
                else
                {
                    ans.push_back(ch);
                }
            }
        }
        return ans;
    }
};